import easygui as eg
import os
import os.path

user_path = eg.fileopenbox(msg=None, title="请选择一个文件", default="*.txt")
with open(user_path) as f:
    title = os.path.basename(user_path)
    msg = "内容如下"
    text = f.read()
    eg.textbox(msg, title, text)
